function checkCart(location_id)
{
	jQuery(document).ready(function(){
		var localStorage = window.localStorage;	
		var items = localStorage.getItem('bakery_items_'+location_id);
		if(items == null)
		{
			return;
		}
		var quantity = 0;
		jQuery.each(JSON.parse(items),function(key,value){
			quantity += parseInt(value.quantity);
		})

		jQuery('#bakery_cart_module .total_products').html('('+quantity + ' ' + Joomla.JText._("MOD_BAKERY_CART_PRODUCTNUMBERJS") + ')');
		//localStorage.removeItem('bakery_items_'+location_id);
	})
}


function showcart(location_id)
{
	var localStorage = window.localStorage;	
	var items = localStorage.getItem('bakery_items_'+location_id);

	if(items == null)
	{
		alertify.alert(Joomla.JText._("MOD_BAKERY_CART_EMPTYJS"));
		return;
	}
	var quantity = 0;
	jQuery.each(JSON.parse(items),function(key,value){
		quantity += value.quantity;
	})
	//console.log(items);return;
	if(parseInt(quantity) > 0)
	{
		var hiddenfield = "<input type='hidden' name='cart' value='"+items+"' />";
		jQuery("#cart_form").append(hiddenfield).trigger("submit");
	}
}